package com.patui.Ui;
import com.patui.widget.PreviewImage;

import android.app.Activity;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
public class ImagePreviewActivity extends Activity{
	private RelativeLayout mContainer;
    private PreviewImage mPreView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		getWindow().setFormat(PixelFormat.TRANSLUCENT);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
		WindowManager.LayoutParams.FLAG_FULLSCREEN);
		
		mContainer = new RelativeLayout(this);
		LayoutParams parmas = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
		mPreView=new PreviewImage(this);
		mContainer.addView(mPreView, parmas);
		this.setContentView(mContainer);
		Intent intent=getIntent();
		Bundle bundle = intent.getExtras();
		if(bundle!=null)
		{
			String picPath=bundle.getString("url");
			mPreView.initView(picPath);
		}
		mPreView.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}

}
